package com.mew.common.enm;


import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;


public enum ExitType{

    Expires(1),  //Session 过期退出
    Repeat(2),    // 重复登录挤掉线, 子游戏
    Switch(3),   //切换账号退出 大厅切换账号
    Exit(9)     // "正常退出" --只能是前端调用退出
    ;

    private final int code;

    ExitType(final int code) {
        this.code = code;
    }

    private final static Map<Integer, ExitType> stateMap
            = Arrays.stream(ExitType.values()).collect(Collectors.toMap(ExitType::code, code -> code));

    public int code() {
        return this.code;
    }

    public static ExitType getByCode(int code){
        return stateMap.get(code);
    }


}
